package com.minimalist.common.feign.client.lindi;

import com.minimalist.common.config.mybatis.bo.PageResp;
import com.minimalist.common.entity.lindi.vo.tradeapplicationconfirmletter.LindiTradeApplicationConfirmLetterQueryVO;
import com.minimalist.common.entity.lindi.vo.tradeapplicationconfirmletter.LindiTradeApplicationConfirmLetterVO;
import com.minimalist.common.feign.config.FeignConfig;
import com.minimalist.common.feign.fallback.lindi.LindiTradeApplicationConfirmLetterFeignClientFallbackFactory;
import com.minimalist.common.response.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 林地指标交易平台_交易申请确认函Feign客户端
 *
 * @author minimalist
 * @since 2024-12-19
 */
@FeignClient(name = "minimalist-lindi"
        , contextId = "lindiTradeApplicationConfirmLetterFeignClient"
        , path = "/minimalist/lindi/tradeApplicationConfirmLetter"
        , configuration = FeignConfig.class
        , fallbackFactory = LindiTradeApplicationConfirmLetterFeignClientFallbackFactory.class)
public interface LindiTradeApplicationConfirmLetterFeignClient{

    /**
     * 添加交易申请确认函
     *
     * @param tradeApplicationConfirmLetterVO 交易申请确认函VO
     * @return 响应结果
     */
    @PostMapping("/addTradeApplicationConfirmLetter")
    R<?> addTradeApplicationConfirmLetter(
            @RequestBody LindiTradeApplicationConfirmLetterVO tradeApplicationConfirmLetterVO);

    /**
     * 删除交易申请确认函 -> 根据确认函ID删除
     *
     * @param confirmLetterId 确认函ID
     * @return 响应结果
     */
    @DeleteMapping("/deleteTradeApplicationConfirmLetterByConfirmLetterId")
    R<?> deleteTradeApplicationConfirmLetterByConfirmLetterId(
            @RequestParam("confirmLetterId") Long confirmLetterId);

    /**
     * 修改交易申请确认函
     *
     * @param tradeApplicationConfirmLetterVO 交易申请确认函VO
     * @return 响应结果
     */
    @PutMapping("/updateTradeApplicationConfirmLetterByConfirmLetterId")
    R<?> updateTradeApplicationConfirmLetterByConfirmLetterId(
            @RequestBody LindiTradeApplicationConfirmLetterVO tradeApplicationConfirmLetterVO);

    /**
     * 查询交易申请确认函列表(分页)
     *
     * @param queryVO 查询条件
     * @return 分页响应结果
     */
    @GetMapping("/getPageTradeApplicationConfirmLetterList")
    R<PageResp<LindiTradeApplicationConfirmLetterVO>> getPageTradeApplicationConfirmLetterList(
            LindiTradeApplicationConfirmLetterQueryVO queryVO);

    /**
     * 根据确认函ID查询交易申请确认函
     *
     * @param confirmLetterId 确认函ID
     * @return 响应结果
     */
    @GetMapping("/getTradeApplicationConfirmLetterByConfirmLetterId/{confirmLetterId}")
    R<LindiTradeApplicationConfirmLetterVO> getTradeApplicationConfirmLetterByConfirmLetterId(
            @PathVariable("confirmLetterId") Long confirmLetterId);

    /**
     * 根据交易申请ID查询当前确认函
     *
     * @param tradeApplicationId 交易申请ID
     * @return 响应结果
     */
    @GetMapping("/getTradeApplicationConfirmLetterByTradeApplicationId/{tradeApplicationId}")
    R<LindiTradeApplicationConfirmLetterVO> getTradeApplicationConfirmLetterByTradeApplicationId(
            @PathVariable("tradeApplicationId") Long tradeApplicationId);

    /**
     * 根据交易申请ID查询交易申请确认函列表
     *
     * @param tradeApplicationId 交易申请ID
     * @return 响应结果
     */
    @GetMapping("/getTradeApplicationConfirmLetterListByTradeApplicationId/{tradeApplicationId}")
    R<List<LindiTradeApplicationConfirmLetterVO>> getTradeApplicationConfirmLetterListByTradeApplicationId(
            @PathVariable("tradeApplicationId") Long tradeApplicationId);

    /**
     * 生成确认函
     *
     * @param tradeApplicationId 交易申请ID
     * @param confirmLetterType  确认函类型
     * @param createId           创建人ID
     * @param tenantId           租户ID
     * @return 响应结果
     */
    @PostMapping("/generateConfirmLetter")
    R<LindiTradeApplicationConfirmLetterVO> generateConfirmLetter(
            @RequestParam("tradeApplicationId") Long tradeApplicationId,
            @RequestParam("confirmLetterType") String confirmLetterType,
            @RequestParam("createId") Long createId,
            @RequestParam("tenantId") Long tenantId);

    /**
     * 删除交易申请确认函文件 -> 根据文件ID删除
     *
     * @param fileId 文件ID
     * @return 响应结果
     */
    @PostMapping("/deleteTradeApplicationConfirmLetterFileByFileId")
    R<?> deleteTradeApplicationConfirmLetterFileByFileId(
            @RequestParam("fileId") Long fileId);
}